package com.cdqidi.core.weixinmanager.util;

import lombok.SneakyThrows;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * 〈一句话功能简述〉<br>
 *
 * @author sjk
 * @create 2019-07-29 16:01
 * @since 1.0.0
 */
public class FileUtil {
    private FileUtil() {

    }

    @SneakyThrows
    public static byte[] readStream(InputStream inStream) {
        try (ByteArrayOutputStream outStream = new ByteArrayOutputStream()) {
            byte[] buffer = new byte[1024];
            int len;
            while ((len = inStream.read(buffer)) != -1) {
                outStream.write(buffer, 0, len);
            }
            return outStream.toByteArray();
        }
    }
}